Skip to content

Conversation

msmithgu
Copy link

Error contexts can contain complex objects with circular references. By making the error context property non-enumerable, it's still accessible directly but won't be included automatically if someone tries to serialize the exception for logging.

@msmithgu
Copy link
Author

This may also address what #46 is trying to address: that is making the error context not writable.

@enicholson
Copy link

@othiym23 any comments on this one? We've found this really helpful preventing crashes in our service which frequently serializes error objects (for responses, logging, etc).

Thanks!

@enicholson
Copy link

enicholson commented Aug 2, 2016

@msmithgu there is one more place where the error@context is assigned on line 85: https://github.com/MyPureCloud/node-continuation-local-storage/blob/efcfebb0151fb92728e82b867b246f4f0af31c4b/context.js#L85

That should have the same behavior...

@Qard Qard changed the base branch from master to error-context-tests August 18, 2016 23:34
@Qard
Copy link
Collaborator

Qard commented Aug 18, 2016

Thanks! I'll add some tests for this and get it merged. 😸

@Qard Qard merged commit aee824a into othiym23:error-context-tests Aug 18, 2016
@wanglihui
Copy link

this fixed my problem! 3q

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants